package com.mes.inventory.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.basicdata.domain.Part;
import com.mes.common.domain.BasicModel;

/**
 * <p>
 * WarehousePart实体，代表库房物料数量统计。
 * </p>
 * author lcs
 * data 2017-03-27
 * 
 */
@Entity()
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name = "I_WAREHOUSEPART")
@BatchSize(size=10)
@Lazy(value=true)
public class WarehousePart extends BasicModel
{

	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name = "UNIQUEID")
	private String uniqueId;
	
	@Override
	public String getUuid() {
		return uniqueId;
	}

	@Override
	public void setUuid(String uuid) {
		this.uniqueId = uuid;
	}
	
	public String getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}

	/**
	 * 库房编号
	 */
	@Column(name="WAREHOUSEID",length=50)
	protected String warehouseUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="WAREHOUSEID",insertable=false,updatable=false)
	protected Warehouse warehouse;

	@Column(name="BINID",length=50)
	protected String warebinUid;
	
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="BINID",insertable=false,updatable=false)
	protected Warebin warebin;

	/**
	 * 零件唯一号
	 */
	@Column(name="PART_NUMBER",length=50)
	protected String partUid;
	
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="PART_NUMBER",insertable=false,updatable=false)
	protected Part part;

	// 盘点周期
	@Column(name="CHECK_TIME",precision=10,scale=4)
	protected Float checkTime;
	
	// 允许最小库存数量
	@Column(name="ALLOWED_MIN_INVENTORY_QUANTITY",precision=10,scale=4)
	protected Float allowedMinInventoryQuantity;
	
	// 库存订货点数量
	@Column(name="ORDER_POINT_STOCK_QUANTITY",precision=10,scale=0)
	protected Integer orderPointStockQuantity;
	
	@Column(name="TOTALQTY",precision=10,scale=4)
	protected Float totalqty;
	
	@Column(name="ABLE_DATA_NUM",precision=10,scale=4)
	protected Float ableDataNum;
	
	@Column(name="ALREADY_DATA_NUM",precision=10,scale=4)
	protected Float alreadyDataNum;

	// Constructors

	/** default constructor */
	public WarehousePart()
	{

	}

	/**
	 * ��ȡ�ⷿ���
	 * 
	 * @return
	 */
	public String getWarehouseUid()
	{
		return warehouseUid;
	}

	/**
	 * ���ÿⷿ���
	 * 
	 * @param warehouseUid
	 */
	public void setWarehouseUid(String warehouseUid)
	{
		this.warehouseUid = warehouseUid;
	}

	/**
	 * ��ȡ�ⷿ����
	 * 
	 * @return
	 */
	public Warehouse getWarehouse()
	{
		return warehouse;
	}

	/**
	 * ���ÿⷿ����
	 * 
	 * @param warehouse
	 */
	public void setWarehouse(Warehouse warehouse)
	{
		this.warehouse = warehouse;
	}

	/**
	 * ��ȡ��λ���
	 * 
	 * @return
	 */
	public String getWarebinUid()
	{
		return warebinUid;
	}

	/**
	 * ���ù�λ���
	 * 
	 * @param warebinUid
	 */
	public void setWarebinUid(String warebinUid)
	{
		this.warebinUid = warebinUid;
	}

	/**
	 * ��ȡ��λ���
	 * 
	 * @return
	 */
	public Warebin getWarebin()
	{
		return warebin;
	}

	/**
	 * ���ù�λ���
	 * 
	 * @param warebin
	 */
	public void setWarebin(Warebin warebin)
	{
		this.warebin = warebin;
	}

	/**
	 * ��ȡ���Ψһ��
	 * 
	 * @return
	 */
	public String getPartUid()
	{
		return partUid;
	}

	/**
	 * �������Ψһ��
	 * 
	 * @param partUid
	 */
	public void setPartUid(String partUid)
	{
		this.partUid = partUid;
	}

	/**
	 * ��ȡ�������
	 * 
	 * @return
	 */
	public Part getPart()
	{
		return part;
	}

	/**
	 * �����������
	 * 
	 * @param part
	 */
	public void setPart(Part part)
	{
		this.part = part;
	}

	/**
	 * ��ȡ�̵�����
	 * 
	 * @return
	 */
	public Float getCheckTime()
	{
		return checkTime;
	}

	/**
	 * �����̵�����
	 * 
	 * @param checkTime
	 */
	public void setCheckTime(Float checkTime)
	{
		this.checkTime = checkTime;
	}

	/**
	 * ��ȡ������С�������
	 * 
	 * @return
	 */
	public Float getAllowedMinInventoryQuantity()
	{
		return allowedMinInventoryQuantity;
	}

	/**
	 * ����������С�������
	 * 
	 * @param allowedMinInventoryQuantity
	 */
	public void setAllowedMinInventoryQuantity(Float allowedMinInventoryQuantity)
	{
		this.allowedMinInventoryQuantity = allowedMinInventoryQuantity;
	}

	/**
	 * ������ȡ
	 * 
	 * @return
	 */
	public Integer getOrderPointStockQuantity()
	{
		return orderPointStockQuantity;
	}

	/**
	 * ��������
	 * 
	 * @param orderPointStockQuantity
	 */
	public void setOrderPointStockQuantity(Integer orderPointStockQuantity)
	{
		this.orderPointStockQuantity = orderPointStockQuantity;
	}


	public Float getTotalqty() {
		return totalqty;
	}

	public void setTotalqty(Float totalqty) {
		this.totalqty = totalqty;
	}

	public Float getAbleDataNum()
	{
		return ableDataNum;
	}

	public void setAbleDataNum(Float ableDataNum)
	{
		this.ableDataNum = ableDataNum;
	}

	public Float getAlreadyDataNum()
	{
		return alreadyDataNum;
	}

	public void setAlreadyDataNum(Float alreadyDataNum)
	{
		this.alreadyDataNum = alreadyDataNum;
	}
}